package Q3;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();
        int len = str.length();

        int left = 0;
        int ret = 1;
        while (left < len) {
            int right = len - 1;
            while(left < right) {
                if (!method(str.substring(left, right + 1))) {
                    ret = Math.max(ret, right - left + 1);
                }
                right--;
            }
            left++;
        }

        System.out.println(ret);

    }

    /**
     * 判断该字符串是否为回文字符串
     * @param str
     * @return
     */
    public static boolean method(String str) {
        int len = str.length();
        int left = 0, right = len - 1;
        while (left < right) {
            if (str.charAt(left) != str.charAt(right)) {
                return false;
            }
        }

        return true;
    }
}
